<?php

/**
 * Статичная страница
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class Type3Form extends BaseMaterialForm
{
  public function configure()
  {
  	
  		unset(
  		$this['created_at'],
  		$this['updated_at'],
  		$this['user_id'],
  		$this['click'],
  		$this['country'],
  		$this['custom_int3'],
  		$this['custom_text1'],
  		$this['custom_text2'],
  		$this['custom_text3'],
  		$this['custom_char2'],
  		$this['custom_char3'],
  		$this['stat'],
  		$this['city']);
  		
   		$c = new Criteria ( );	
		$c->addAnd ( FolderPeer::TREE_PARENT, 1, Criteria::NOT_EQUAL );
		$c->addAnd ( MaterialPeer::ID, 'tt' ); 		

	  $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'title'           => new sfWidgetFormInput(array(),array('size'=>97)),
	  'content'  => new sfWidgetFormCKEditor (array('jsoptions'=>array('filebrowserBrowseUrl'=>"'/ckfinder/ckfinder.html'",
  	                                                                             'filebrowserUploadUrl' => "'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'",
                                                                                 'toolbar ' => "[['Source','Font', 'FontSize', 'TextColor', 'Bold', 'Italic','PasteFromWord', 'PasteText', 'Table', 'Link', 'JustifyLeft', 'JustifyCenter','JustifyRight', 'JustifyBlock', 'Underline']]")) ),
  	 
      'type_id'         => new sfWidgetFormInputHidden(array(), array('value' =>'3', 'class'=>'test')),
	  'photo_path' =>  new sfWidgetFormInputFile (  array (), array('mat_id'=>$this->object->getId(),'folder'=>'files') ),
  	  'seo_description' => new sfWidgetFormTextarea(array(),array('style'=>'width:620px')),
  	  'seo_keyword' => new sfWidgetFormTextarea(array(),array('style'=>'width:620px'))
      ));

    /*
     *'content' => new sfWidgetFormTextareaTinyMCE(array(),array('class'=>'material_content','width'=>'600px')),
     *  
     */
      
    if(sfConfig::get('app_use_simple_region')==true)
    {
    $this->widgetSchema['region_id'] =  new sfWidgetFormPropelChoice(array('multiple' => false, 'expanded' => true, 'model' => 'Region', 'add_empty' => false));
    }    
      
  		
  		$this->widgetSchema->setLabels(array(  
  		'content'   => 'Содержимое',
  		'parent_id'   => 'Пренадлежность',
  		 'custom_file1'   => 'Фоновый рисунок',
  		 'custom_bool1'   => 'Конт. информация',
  		 'link'   => 'Ссылка',
  	 ));
  		

     $this->validatorSchema['photo_path'] = new sfValidatorFile(array(
        'required'   => false,
        'path'       => sfConfig::get('sf_web_dir').'/uploads/material/files', 
         
        'max_size'   => 3000000, // 360 kB 
        ));
  	
       
        $this->validatorSchema->setOption('allow_extra_fields', true);    
  		 
  		 $this->widgetSchema->setNameFormat('material[%s]');	 
  		 
  		//    $js_path = '/js/tinymce/tiny_mce.js';
        //    sfContext::getInstance()->getResponse()->addJavascript($js_path);
            
        
            
            
  
  }
  
  
  
  function myFormatter($widget, $inputs)
  {
    $str = '<b>Разное</b>'.get_partial('checked_folders',array('arr'=>$this['mat2_folder_list']->getValue(),'form'=>$this,'scope_id'=>sfConfig::get('app_scope_other'))).get_component('zdFolder','show_folders',array('arr'=>$this['mat2_folder_list']->getValue(),'folder_id'=>sfConfig::get('app_folder_other'),'width_check'=>'yes'));
    //$str .= '<b>Регионы</b>'.get_partial('checked_folders',array('form'=>$this,'scope_id'=>sfConfig::get('app_scope_region'))).get_component('zdFolder','show_folders',array('folder_id'=>sfConfig::get('app_folder_region'),'width_check'=>'yes'));
    return $str;
  }

  
   
}
